package org.jeecg.modules.zhima.admin.service.impl;

import org.jeecg.modules.zhima.admin.mapper.ZmActivityMapper;
import org.jeecg.modules.zhima.admin.service.IZmActivityService;
import org.jeecg.modules.zhima.admin.entity.ZmActivity;
import org.jeecg.modules.zhima.admin.mapper.ZmActivityTaskMapper;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.Collection;

/**
 * @Description: zm_activity
 * @Author: jeecg-boot
 * @Date:   2021-02-20
 * @Version: V1.0
 */
@Service
public class ZmActivityServiceImpl extends ServiceImpl<ZmActivityMapper, ZmActivity> implements IZmActivityService {

	@Autowired
	private ZmActivityMapper zmActivityMapper;
	@Autowired
	private ZmActivityTaskMapper zmActivityTaskMapper;
	
	@Override
	@Transactional
	public void delMain(String id) {
		zmActivityTaskMapper.deleteByMainId(id);
		zmActivityMapper.deleteById(id);
	}

	@Override
	@Transactional
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			zmActivityTaskMapper.deleteByMainId(id.toString());
			zmActivityMapper.deleteById(id);
		}
	}
	
}
